<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/jsp/common/head.jsp"%>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>用户管理页面 >> 用户修改页面</span>
        </div>
        <div class="providerAdd">
        <form id="userForm" name="userForm" method="post" action="${pageContext.request.contextPath}/user/userMod">
			<input type="hidden" name="id" value="${userInfo.id}"/>
			 <div>
                    <label for="userName">用户名称：</label>
                    <input type="text" name="userName" id="userName" value="${userInfo.userName}">
					<font color="red"></font>
             </div>
			 <div>
                    <label >用户性别：</label>
                    <select name="gender" id="gender">
                        <option value="1" <c:if test="${userInfo.gender == 1 }" > selected </c:if> >女</option>
                        <option value="2" <c:if test="${userInfo.gender == 2 }" > selected </c:if> >男</option>
					 </select>
             </div>
			 <div>
                    <label for="birthday">出生日期：</label>
                    <input type="text" Class="Wdate" id="birthday" name="birthday" value="<fmt:formatDate value='${userInfo.birthday}' pattern='yyyy-MM-dd'/>"
					readonly="readonly" onclick="WdatePicker();">
                    <font color="red"></font>
              </div>
			
		       <div>
                    <label for="address">用户电话：</label>
                    <input type="text" name="phone" id="phone" value="${userInfo.phone}">
                    <font color="red"></font>
               </div>
                <div>
                    <label for="address">用户地址：</label>
                    <input type="text" name="address" id="address" value="${userInfo.address}">
                </div>
				<div>
                    <label >用户角色：</label>
                    <!-- 列出所有的角色分类 -->
                    <!-- 遍历用户角色列表 -->
                    <select name="userRole">
                        <c:forEach items="${roleList}" var="role">
                            <!-- 根据用户的userRole 与  角色的 id 匹配对应的 角色 -->
                            <option value="${role.id}"
                                    <c:if test="${ role.id eq userInfo.userRole}">
                                        selected="selected"
                                    </c:if>
                            >${role.roleName}</option>
                        </c:forEach>
                    </select>
        				<font color="red"></font>
                </div>
			 <div class="providerAddBtn">
                    <input type="button" name="save" id="save" value="保存" />
                    <input type="button" id="back" name="back" value="返回"/>
                </div>
            </form>
        </div>
    </div>
</section>
<%@include file="/jsp/common/foot.jsp" %>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js" ></script>
<script type="text/javascript">
    $(function() {
        $("#save").click(function () {
            if(confirm("是否确认修改信息？")){
                $("#userForm").submit();
            }
        });

    });
</script>